package main

import (
	"fmt"
	"strings"
)

func reversePrefix(word string, ch byte) string {
	bytes := []byte(word)
	left, right := 0, strings.IndexByte(word, ch)
	for left < right {
		bytes[right], bytes[left] = bytes[left], bytes[right]
		left++
		right--
	}
	return string(bytes)
}
func main() {
	fmt.Println(reversePrefix("abcdefd", 'd'))
}
